package hello.app.component;

import java.util.Iterator;
import java.util.Map;

public class HistoryItem {
	private String name;
	private String number;
	private String eval;
	private String datetime;
	private Map<String, String> others;
	private int type = 1;
	public static final int INCOMING = 1;
	public static final int OUTGOING = 2;
	public static final int MISSED = 3;
	private boolean personal = true;

	public HistoryItem(String name, String number,String eval, String datetime, Map<String, String> others,int type ,boolean personal){
		this.name = name;
		this.number = number;
		this.datetime = datetime;
		this.eval = eval;
		this.others = others;
		this.setType(type);
		this.personal = personal;
	}

	public boolean isPersonal(){
		return personal;
	}

	public String getDatetime() {
		return datetime;
	}
	public void setDatetime(String datetime) {
		this.datetime = datetime;
	}
	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public String getOthers() {
		String ret = "";
		Iterator<String> it = others.keySet().iterator();
		while(it.hasNext()){
			String key = it.next();
			if(it.hasNext())
				ret += key + others.get(key) + "\n";
			else
				ret += key + others.get(key);
		}
		return ret;
	}

	public void setOthers(Map<String, String> others) {
		this.others = others;
	}

	public String getEval() {
		return eval;
	}

	public void setEval(String eval) {
		this.eval = eval;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

}
